package com.itheima.reggie.common;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLIntegrityConstraintViolationException;


/**
 * Exception最大异常
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler02 {

    @ExceptionHandler(Exception.class)
    public R<String> sqlException(Exception ex) {

        log.error(ex.getMessage());
        return R.error("系统异常");
    }
}
